using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Globalization;

namespace RAP.Framework.Libary.JSON.Conversion.Converters
{
    public sealed class NullableInt32Importer : Int32Importer
    {
        public NullableInt32Importer ( )
            : base ( ) 
        {
            this.SetOutputType ( typeof ( Nullable<Int32> ) );
        }

        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }
    }

    public sealed class NullableInt16Importer : Int16Importer
    {
        public NullableInt16Importer ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Int16> ) );
        }

        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }
    }

    public sealed class NullableInt64Importer : Int64Importer
    {
        public NullableInt64Importer ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Int64> ) );
        }

        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }
    }

    public sealed class NullableByteImporter : ByteImporter
    {
        public NullableByteImporter ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Byte> ) );
        }
        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }

    }

    public sealed class NullableSingleImporter : SingleImporter
    {
        public NullableSingleImporter ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Single> ) );
        }

        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }
    }

    public sealed class NullableDoubleImporter : DoubleImporter
    {
        public NullableDoubleImporter ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Double> ) );
        }

        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }
    }

    public sealed class NullableDecimalImporter : DecimalImporter
    {
        public NullableDecimalImporter ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Decimal> ) );
        }

        protected override object ConvertFromString ( string s )
        {
            object value = null;
            try
            {
                value = base.ConvertFromString ( s );
            }
            catch
            {
            }
            return value;
        }
    }

    public sealed class NullableDateTimeImporter : DateTimeImporter
    {
        public NullableDateTimeImporter()
            : base()
        {
            this.SetOutputType(typeof(Nullable<DateTime>));
        }
    }

    public sealed class NullableBooleanImporter : BooleanImporter
    {
        public NullableBooleanImporter ( )
            : base ( )
        {
            this.SetOutputType ( typeof ( Nullable<Boolean> ) );
        }
    }
}
